package pl.olap.dao;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "production")
public class Production extends BaseEntity {

	/**
	 * 
	 */
	public Production() {
		super();
	}

	private static final long serialVersionUID = 1L;
	private static final int NORMAL_LENGTH = 255;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(updatable = false, name = "PRODUCTION_ID")
	private Integer idProduction;

	@Column(length = NORMAL_LENGTH, nullable = true)
	private String name;

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "productions")
	private List<Movie> movies;

	/**
	 * @return the idProduction
	 */
	public Integer getIdProduction() {
		return idProduction;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the movies
	 */
	public List<Movie> getMovies() {
		return movies;
	}

	/**
	 * @param idProduction
	 *            the idProduction to set
	 */
	public void setIdProduction(Integer idProduction) {
		this.idProduction = idProduction;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param movies
	 *            the movies to set
	 */
	public void setMovies(List<Movie> movies) {
		this.movies = movies;
	}
}
